home *** CD-ROM | disk | FTP | other *** search
- /* $VER: ArcMast.rexx 2.0 (25.10.97) by J. Tierney
-
- Archive Master 2.0
- 10/25/97 J. Tierney
-
- Function: Extract, list, or test many types of archives.
-
- Usage: ArcMast.rexx <file> <opt> [<dest>]
-
- <file> - The archive to operate on.
-
- <opt> - E \
- - X - Extract the archive's contents.
- - L - List the archive's contents.
- - T - Test the archive.
-
- <dest> - Destination path. Optional; if not specified then <file>'s path
- (assuming one was given) is used.
-
-
- Expanding ArcMast:
- Add the following lines to add new archivers to ArcMast.rexx.
-
- arc.<index>.ext = '<The filename extension used to recognize an archive.>'
- arc.<index>.unarc = '<Command to extract the archive.>'
- arc.<index>.list = '<Command to list the archive.>'
- arc.<index>.test = '<Command to test the archive.>'
-
- If an option isn't supported, then leave that entry blank. For example:
- arc.3.test = ''
- means there is no test option.
-
- And then set the variable "arc.count" to the last index number used.
- */
-
- arc.count = 6 /* Set this to the last index number used. */
-
- arc.0.ext = '.LHA' /* The archive's extension. */
- arc.0.unarc = 'C:LZX x' /* Extract command. */
- arc.0.list = 'C:LZX v' /* List command. */
- arc.0.test = 'C:LZX t' /* Test command. */
-
- arc.1.ext = '.LZX'
- arc.1.unarc = 'C:LZX x'
- arc.1.list = 'C:LZX v'
- arc.1.test = 'C:LZX t'
-
- arc.2.ext = '.LZH'
- arc.2.unarc = 'C:LZX x'
- arc.2.list = 'C:LZX v'
- arc.2.test = 'C:LZX t'
-
- arc.3.ext = '.ZIP'
- arc.3.unarc = 'C:UnZip'
- arc.3.list = 'C:UnZip -l'
- arc.3.test = 'C:UnZip -t'
-
- arc.4.ext = '.ZOO'
- arc.4.unarc = 'C:Zoo x'
- arc.4.list = 'C:Zoo l'
- arc.4.test = 'C:Zoo t'
-
- arc.5.ext = '.ARC'
- arc.5.unarc = 'C:ArcX -x'
- arc.5.list = 'C:ArcX -l'
- arc.5.test = 'C:ArcX -t'
-
- arc.6.ext = '.DL'
- arc.6.unarc = 'SYS:Graphics/UnDL'
- arc.6.list = '' /* No list option. */
- arc.6.test = '' /* No test option. */
-
- /*
- Copy and fill in the following lines to expand ArcMast.rexx.
- Don't forget to set the arc.count variable, too!
-
- arc..ext = '' /* The archive's extension. */
- arc..unarc = '' /* Extract command. */
- arc..list = '' /* List command. */
- arc..test = '' /* Test command. */
-
- */
-
-
-
-
- /* *** Program Begins Here *** */
-
- PARSE ARG fname opt dest .
-
- opt = UPPER(opt)
-
- IF dest = '' THEN DO
- x = POS('/', fname)
- IF x = 0 THEN x = POS(':', fname)
- IF x ~=0 THEN dest = LEFT(fname, x)
- END
-
- x = LASTPOS('.', fname)
- fext = UPPER(SUBSTR(fname, x))
-
- arcidx = -1
- DO i = 0 TO arc.count
- IF arc.i.ext = fext THEN DO
- arcidx = i
- LEAVE
- END
- END
- IF arcidx = -1 THEN DO
- SAY 'ERROR: Unknown extension -' fext
- EXIT 10
- END
-
- SELECT
- WHEN opt = 'E' | opt = 'X' THEN cmd = arc.arcidx.unarc
- WHEN opt = 'L' THEN cmd = arc.arcidx.list
- WHEN opt = 'T' THEN cmd = arc.arcidx.test
- OTHERWISE DO
- SAY 'ERROR: Unknown option -' opt
- EXIT 10
- END
- END
-
- IF cmd = '' THEN DO
- SAY 'ERROR: Option' opt 'is not available for' fext 'archives.'
- EXIT 5
- END
-
- CALL PRAGMA('D', dest)
- ADDRESS COMMAND cmd fname
-